/*****************************************************************************
 *   Copyright 2005 Tim A Wang
 *
 *   Licensed under the Apache License, Version 2.0 (the "License");
 *   you may not use this file except in compliance with the License.
 *   You may obtain a copy of the License at
 *
 *       http://www.apache.org/licenses/LICENSE-2.0
 *
 *   Unless required by applicable law or agreed to in writing, software
 *   distributed under the License is distributed on an "AS IS" BASIS,
 *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *   See the License for the specific language governing permissions and
 *   limitations under the License.
 *
 ****************************************************************************/
package com.jb.web.bean.content.provider;

import com.jb.web.bean.content.Portal;
import com.jb.web.bean.content.PortalContentProvider;
import com.jb.web.context.WebContext;


public class RssProvider implements PortalContentProvider {
    boolean edit;

    public StringBuffer getContent(WebContext ctx, Portal portal) {
        String content = (String) com.jb.web.content.ContentManager.getInstance(ctx, portal.isPersonalizable()).get(portal.getClientId());
        StringBuffer stringBuffer = new StringBuffer();
        stringBuffer.append("<div id=\"" + portal.getClientId() +
            "editor\" style=\"background-color: #FFF2F0; display:none; height:100px;\">")
                    .append("<label for=rssItem >Rss Feed</label><input name=rssItem type=text width=\"100px\" /><br>")
                    .append("<input type=button value=\"Change\"></input></div><p>");

        return stringBuffer.append("<div>" + content + "</div>");
    }

    public void delete(WebContext ctx, Portal portal) {
        //no-op
    }

    public void edit(WebContext ctx, Portal portal) {
        edit = !edit;
    }
}
